package com.tools;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.bean.RIarticles;




public class RelativeInformationJson {
 private ArrayList<RIarticles> rIarticles;
 public ArrayList<RIarticles> json(String respose){
	 try {
	JSONObject object=new JSONObject(respose);
	JSONObject object2 = object.getJSONObject("paramz");
	JSONArray jsonArray = object2.getJSONArray("articles");
	rIarticles=new ArrayList<RIarticles>();
	for (int i = 0; i < jsonArray.length(); i++) {
		JSONObject articleobj = jsonArray.getJSONObject(i);
		RIarticles articles=new RIarticles();
		articles.setCategory(articleobj.getString("category"));
		articles.setCover(articleobj.getString("cover"));
		articles.setFormat(articleobj.getString("format"));
		articles.setId(articleobj.getString("id"));
		articles.setSubject(articleobj.getString("subject"));
		articles.setSummary(articleobj.getString("summary"));
		rIarticles.add(articles);
	}
	} catch (JSONException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return rIarticles;
	 
 }
}
